package com.zscg.sequence.ui.view;

import com.zscg.sequence.R;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;


public class LoadMoreView extends RelativeLayout {

	TextView moreView;

	ProgressBar loadingProcessBar;

	public LoadMoreView(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	protected void onFinishInflate() {
		moreView = (TextView) findViewById(R.id.moreView);
		loadingProcessBar = (ProgressBar) findViewById(R.id.loadingProgressBar);
		this.nomore();
	}

	public boolean isReady() {
		return moreView.getVisibility() == View.VISIBLE;
	}

	public void ready() {
		moreView.setVisibility(View.VISIBLE);
		loadingProcessBar.setVisibility(View.GONE);
	}

	public boolean isLoading() {
		return loadingProcessBar.getVisibility() == View.VISIBLE;
	}

	public void loading() {
		moreView.setVisibility(View.GONE);
		loadingProcessBar.setVisibility(View.VISIBLE);
	}

	public boolean isNomore() {
		return moreView.getVisibility() == View.GONE
				&& loadingProcessBar.getVisibility() == View.GONE;
	}

	public void nomore() {
		moreView.setVisibility(View.GONE);
		loadingProcessBar.setVisibility(View.GONE);
	}

}
